package com.game.element
{
	import com.game.element.hp.HpBar;
	import com.game.element.hp.ReloadBar;
	import com.interfaces.game.GlobalAPI;
	import com.interfaces.general.mangaer.IDispose;
	import com.interfaces.general.mangaer.ITick;
	
	import fl.core.UIComponent;
	
	public class BaseElement extends UIComponent implements ITick ,IDispose
	{
		public var hpBar:HpBar = new HpBar;
		public var reloadBar:ReloadBar = new ReloadBar;
		public var allBuffList:Array = [];
		
		public function BaseElement()
		{
			super();
			// 血量
			// 名字
			// 攻击力
			// x
			// y
			// ai
			// 攻击距离
			
			this.graphics.clear();
			this.graphics.beginFill(Math.random()*0xFFFFFF,1);
			this.graphics.drawRect(-15,-15,30,30);
			this.graphics.endFill();
			
			hpBar.setValue(100,100);
			hpBar.x = -15;
			hpBar.y = -18;
			addChild(hpBar);

			reloadBar.setValue(100,100);
			reloadBar.x = -15;
			reloadBar.y = -14;
			reloadBar.visible = false;
			addChild(reloadBar);
		}
		
		public function exce():void
		{
		}
		
		public function set tickPriority(priority:int):void
		{
		}
		
		public function get tickPriority():int
		{
			return 0;
		}
		
		public function dispose():void{
			GlobalAPI.tickManager.unRegeditTick(this);
			if(this.parent != null && this.parent.contains(this)){
				this.parent.removeChild(this);
			}
		}
	}
}